<template>
	<view class="con-box">
		<u-navbar title="" height="120upx">
			<view class="u-nav-slot" slot="left">
				<view @tap="back" class="icon-left">
					<u-icon name="arrow-left" color="#fff" size="26"></u-icon>
				</view>
			</view>
			<view class="u-nav-slot logoBox" slot="center">
				<view class="navBox">问题详情</view>
			</view>
			<view class="u-nav-slot" slot="right">
				<view class="icon-right">
				</view>
			</view>
		</u-navbar>
		
		<view class="title">{{newsInfo.categoryName}}</view>
		<view class="desc" v-html="newsInfo.content"></view>
	</view>
</template>

<script>
	import {getNewsDetails} from '../../api/user.js'
	export default {
		data(){
			return {
				newsInfo:{}
			}
		},
		onLoad(opt) {
			this.getInfo(opt.id);
		},
		methods:{
			getInfo(id){
				getNewsDetails({id}).then(res => {
					if (res.data.success) {
						this.newsInfo = res.data.obj;
					}
				});
			},
			back(){
				let canNavBack = getCurrentPages();
				if(canNavBack && canNavBack.length>1) {  
				    uni.navigateBack({  
				      delta: 1  
				    });  
				} else {  
				    history.back();  
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.con-box {
		min-height: 100vh;
		padding: 150upx 30upx 0;
	
		.logoBox{
			width: 100%;
			height: 100%;
			.navBox{
				height: 120upx;
				background-image: url("@/static/common/bg1.png");
				background-size: 100% 100%;
				background-repeat: no-repeat;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #fff;
			}
		}
		
		.title{
			font-size: 40upx;
			font-weight: 800;
			color: #333;
			padding-top: 40upx;
			text-align: left;
		}
		
		.desc{
			font-size: 30upx;
			font-weight: 400;
			padding-top: 70upx;
			color: #333;
			line-height: 34upx;
		}
	}
</style>
